package initialize

import (
	"wisdomCoach/controller/systemController"
	"wisdomCoach/middleware"
	"wisdomCoach/router"

	"github.com/gin-gonic/gin"
)

func InitRouter() *gin.Engine {
	Router := gin.New()
	Router.Use(gin.Recovery())
	if gin.Mode() == gin.DebugMode {
		Router.Use(gin.Logger())
	}
	systemRouter := router.RouterGroupApp.System
	PrivateGroup := Router.Group("v1")
	systemGroup := Router.Group("system")
	{
		systemRouter.InitCaptchaRouter(PrivateGroup)
		systemRouter.InitLoginRouter(PrivateGroup)
		systemRouter.InitRegisterRouter(PrivateGroup)

	}
	PrivateGroup.Use(middleware.AuthRequired())
	systemGroup.Use(middleware.AuthRequired())
	PrivateGroup.GET("getInfo", systemController.GetInfo)
	{
		systemRouter.InitUserRouter(systemGroup)
		systemRouter.InitRoutersRouter(PrivateGroup)
		systemRouter.InitDictRouter(systemGroup)

	}

	return Router
}
